fix: UI review bugs#414
Conversation
871c3da to
d3b8440
Compare
|
Two actionable issues remain in this PR's exact diff:
|
|
Fixed the modal title contract and limited the manage screen to preview-only CodeMirror assets. Verified with lint, PHPUnit, build, and targeted E2E checks. |
|
One preview regression remains for users who disable syntax highlighting. |
|
Guarded the editor bootstrap so the read-only textarea remains a functional fallback when |
|
Follow-up adversarial re-audit found two remaining issues:
|
|
Resolved both follow-ups. The fallback E2E setup now explicitly establishes table view before using table selectors, and notice ownership compares normalized plugin-root paths with a directory-separator boundary, including a sibling-prefix regression case. The relevant tests, lint, and build pass. |
|
Round 4 found two issues in this PR's own head:
|
…te orphaned Prism wrapper
…petspro/code-snippets into fix/166-ui-review-fixes/core
|
|
|
||
| .active-snippet { | ||
| td, th { | ||
| background-color: rgba(#78c8e6, 0.06); |
There was a problem hiding this comment.
use modern syntax, rgb() instead of rgba().
| background-color: rgba(#78c8e6, 0.06); | |
| background-color: rgb(120 200 230 / 0.06); |
There was a problem hiding this comment.
Done — rgb() syntax in the touched files (stylelint canonicalizes the alpha to / 6%).
| border: none; | ||
| background: none; | ||
| font: inherit; | ||
| color: #2271b1; |
There was a problem hiding this comment.
All #2271b1 colors can be replaced with sass theme.$accent. there are multiple instances that can be changed.
There was a problem hiding this comment.
Replaced the hardcoded #2271b1 instances with theme.$accent in the touched stylesheets.
| inline-size: 20px; | ||
| block-size: 20px; | ||
| margin: 0; | ||
| border: 1px solid #c3c4c7; |
There was a problem hiding this comment.
replace #c3c4c7 with theme.$control-border. Do that in other places too where the corder color is hardcoded.
There was a problem hiding this comment.
Replaced with theme.$control-border, along with the other hardcoded border colours in touched files.
| ul.cloud-search-results.code-snippets-cards { | ||
| grid-template-columns: repeat(3, minmax(0, 1fr)); | ||
|
|
||
| @media screen and (width <= 1100px) { |
There was a problem hiding this comment.
Remove screen and from the media query.
| <PagingInput which={which} totalPages={totalPages} {...inputProps} /> | ||
| <span className="tablenav-paging-text"> | ||
| {/* translators: 1: Current page. */ | ||
| _x(' of ', 'paging', 'code-snippets')} |
There was a problem hiding this comment.
Not sure how, but the string should be %1$s of %2$s.
There was a problem hiding this comment.
The bottom pager now uses sprintf( _x( '%1$s of %2$s', … ) ). The top pager keeps split markup because the current page is an editable input (core list-table pattern); its stale translator comment is corrected.
| const TAB_LABELS: Record<CommunityTab, string> = { | ||
| snippets: __('Snippets', 'code-snippets'), | ||
| bundles: __('Bundles', 'code-snippets') | ||
| } | ||
|
|
There was a problem hiding this comment.
Don't see the advantage of this change.
There was a problem hiding this comment.
The map earned its keep since this comment — it is now used in three places (both tab labels and the page title), so removing it would duplicate the strings. Happy to inline it if you still prefer.
| /* translators: %s: cloud library author name. */ | ||
| _x('By %s', 'snippet author', 'code-snippets'), |
There was a problem hiding this comment.
No need to use both context and translators comment.
| /* translators: %s: cloud library author name. */ | |
| _x('By %s', 'snippet author', 'code-snippets'), | |
| /* translators: %s: cloud library author name. */ | |
| __('By %s', 'code-snippets'), |
when using context function _x() it creates a separate string, inflating the amount of strings to translate.
There was a problem hiding this comment.
Kept the _x() context and dropped the redundant translators comment.
| id="snippets-tag-filter" | ||
| name="tag" | ||
| value={currentTag} | ||
| aria-label={__('Filter snippets by tag', 'code-snippets')} |
There was a problem hiding this comment.
aria-label is not required, it has a <label> pointing to this <select> element.
There was a problem hiding this comment.
Removed the redundant aria-label.
| echo '<div class="error fade"><p><strong>'; | ||
| // The code-snippets-notice class exempts this notice from the plugin's | ||
| // own admin notice filtering on Code Snippets screens. | ||
| echo '<div class="code-snippets-notice error fade"><p><strong>'; |
There was a problem hiding this comment.
add role=region and aria-label.
There was a problem hiding this comment.
Added role="region" with a translated aria-label to both notices.
|
|
||
| if ( defined( 'CODE_SNIPPETS_FILE' ) ) { | ||
| echo '<div class="error fade"><p>'; | ||
| echo '<div class="code-snippets-notice error fade"><p>'; |
There was a problem hiding this comment.
add role=region and aria-label.
There was a problem hiding this comment.
Added role="region" with a translated aria-label here as well.
f79d53c to
92bf71d
Compare
|
Addressed the outstanding audit findings: local snippet descriptions now round-trip storage unmodified, with sanitization applied at the cloud payload decode boundary and a regression test covering legacy content; featured results use the cloud-search page size so the |
|
|
Added the omitted block tags to |
Download and install |
Changes
Cloud snippet descriptions render as plain text
Community Cloud snippet descriptions are stripped of HTML tags before display, in both the card and table views.
Foreign admin notices hidden on plugin screens
On Code Snippets admin screens, admin notices that do not originate from the plugin are removed server-side and hidden via a CSS fallback, so core/third-party notices no longer break the plugin layout. Behaviour is gated by the
code_snippets/admin/filter_foreign_noticesfilter (default enabled). AddsAdmin\Notice_Filterand a unit test.Snippet preview modal
Verification
lint:js,lint:styles,lint:phpand the webpack build pass.